package cic;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JLabel;
import javax.swing.JTextField;

public class ReportGUI extends JFrame {

	private JPanel contentPane;
	private JTextField textField;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					ReportGUI frame = new ReportGUI("");
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public ReportGUI(final String username) {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JButton btnNewButton = new JButton("Report");
		btnNewButton.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				ReportController.report(username, textField.getText());
			}
		});
		btnNewButton.setBounds(170, 172, 117, 29);
		btnNewButton.setName("report");
		contentPane.add(btnNewButton);
		
		JLabel lblInsuranceNumber = new JLabel("Insurance number:");
		lblInsuranceNumber.setBounds(6, 6, 160, 16);
		contentPane.add(lblInsuranceNumber);
		
		textField = new JTextField();
		textField.setName("insunumber");
		textField.setBounds(75, 56, 288, 29);
		contentPane.add(textField);
		textField.setColumns(10);
	}
}
